Skip to content

feat(agent): highlight text files in the file preview dialog - #45032

Merged
lyzno1 merged 2 commits into
mainfrom
feat/agent-file-preview-highlight
Oct 29, 2026
Merged

lyzno1 merged 2 commits into
mainfrom
feat/agent-file-preview-highlight

Conversation

@lyzno1

@lyzno1 lyzno1 commented Oct 29, 2026

Copy link
Copy Markdown
Member

Closes #45031

  • Highlight text previews in the Agent V2 file preview dialog with @pierre/highlights, choosing the language from the file extension or the bare name (Dockerfile). .txt and unknown languages stay plain text.
  • Load the highlighter and both GitHub themes on demand, and show plain text until they load or if tokenizing fails.
  • Tokenize once for both themes (--hls-light / --hls-dark) and switch colors in CSS through data-theme, so changing the theme does not re-tokenize.
  • Cap tokenized line length at 1000 so long minified lines stay a single span.
  • Export getFileExtension from file-icon.ts for reuse.

@lyzno1
lyzno1 requested a review from hyoban as a code owner October 29, 2026 04:57
@github-actions github-actions Bot added size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web. labels Oct 29, 2026
@lyzno1
lyzno1 enabled auto-merge October 29, 2026 04:59
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.55%. Comparing base (9e978de) to head (70fc81c).

Files with missing lines Patch % Lines
...re/components/orchestrate/skills/detail-dialog.tsx 85.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #45032   +/-   ##
=======================================
  Coverage   89.55%   89.55%           
=======================================
  Files        6013     6013           
  Lines      377204   377224   +20     
  Branches    76362    76368    +6     
=======================================
+ Hits       337811   337831   +20     
  Misses      33400    33400           
  Partials     5993     5993           
Flag Coverage Δ
dify-ui 92.65% <ø> (ø)
web 89.52% <85.71%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lyzno1
lyzno1 added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 5e0e69f Oct 29, 2026
53 of 54 checks passed
@lyzno1
lyzno1 deleted the feat/agent-file-preview-highlight branch October 29, 2026 05:14
@laipz8200 laipz8200 mentioned this pull request Nov 3, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent V2 file preview renders code and config files without syntax highlighting

2 participants